public class Main {
	private double x,y;
	public Main(double real,double imaginary) {
		x=real;
		y=imaginary;
	}
	public String toString () {
		return "("+(float)x+","+(float)y+"i"+")";
	}
	public Main add(Main a) {
		return new Main(this.x+a.x,this.y+a.y);
	}
	public Main add(double a,double b)
	{
		return new Main(x+a,y+b);
		
	}
	public static Main add(Main a,Main b) {
		return new Main(a.x+b.x,a.y+b.y);
	}
	public Main fac(Main a) {
		return new Main((x*a.x-y*a.y),(x*a.y+y*a.x));
	}
	public Main fac(double a,double b)
	{
		return new Main((x*a-y*b),(x*b+y*a));
		
	}
	public static Main fac(Main a,Main b) {
		return new Main((b.x*a.x-b.y*a.y),(b.x*a.y+b.y*a.x));
	}
	public static double fat(Main a) {
		return Math.sqrt(a.x*a.x+a.y*a.y);
	}
	public static void main(String[] args) {
		Main x,y,z;
		x=new Main(4,5);
		y=new Main(3.4,2.8);
		System.out.println("相加结果为");
		z=add(x,y);
		System.out.println("result1="+z);
		z=x.add(y);
		System.out.println("result2="+z);
		z=x.add(6,8);
		System.out.println("result3="+z);
		System.out.println("相乘结果为");
		z=fac(x,y);
		System.out.println("result4="+z);
		z=x.fac(y);
		System.out.println("result5="+z);
		z=x.fac(6,8);
		System.out.println("result6="+z);
		System.out.println("模结果为");
		System.out.println("result7="+(float)fat(z));
	}
}